#include <stdio.h>
#include "Bitmap.hpp"

#include <windows.h>

class CTimeEx		//	用于测量程序执行的时间长度
{
public:
	CTimeEx()
	{
		::QueryPerformanceFrequency(&freq);
		::QueryPerformanceCounter(&t0);
	}

	void SetMark()
	{
		::QueryPerformanceCounter(&t0);
	}

	float GetSpeed()
	{
		::QueryPerformanceCounter(&t1);
		unsigned long t = t1.u.LowPart - t0.u.LowPart;
		return 1.0f*t/freq.u.LowPart;
	}

	LARGE_INTEGER t0, t1, freq;	
};

int main()
{
	CTimeEx time;
	CBitmap * pB = CBitmap::CreateBitmap32(31960, 1024);

	time.SetMark();

	for(int i=0; i<1000; ++i)
		pB->FillRect(0, 0, pB->GetWidth(), pB->GetHeight(), 0xAAAAAAAA);
	pB->DrawLine(0, pB->GetHeight()/2, pB->GetWidth(), 1);

	float speed = time.GetSpeed();
	printf("ms : %f\n", speed);

	pB->SaveFile("n.bmp");
	delete pB;

	return 0;
}

